package com.campus.client.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.campus.pojos.domain.ClientScore;
import com.campus.result.Result;
import com.campus.service.ScoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/client/score")
public class ScoreController {

    @Autowired
    private ScoreService scoreService;
    /**
     * 根据用户id查询用户课程成绩
     * @param id
     * @return
     */
    @GetMapping("/{id}")
    public Result<List<ClientScore>> getScore(@PathVariable Long id){
        QueryWrapper<ClientScore> qw = new QueryWrapper<>();
        qw.eq("user_id", id);
        return Result.success(scoreService.list(qw));
    }
}
